from  rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
class PageNumberPaginations(PageNumberPagination):
	page_size=2#每页数据量
	page_query_param='page'#?page=1跳转页
	max_page_size= 10 #每页最大数据量
	page_size_query_param='size'
	def get_paginated_response(self, data):
		return Response({
			'links': {
				'next': self.get_next_link(),
				'previous': self.get_previous_link()
			},
			'count': self.page.paginator.count,
			'results': data})

